import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
import Home from '../props/home/Index'
const routers = createBrowserRouter([
    {
        path: '/',
        element: <App></App>,
        children: [
            {
                index:true,
                element:<Home></Home>
            },
            {
                path: 'home',
                lazy: async () => {
                    const { default: Home } = await import('../props/home/Index')
                    return {
                        element: <Home></Home>
                    }
                }
            },
            {
                path: 'message',
                lazy: async () => {
                    const { default: Message } = await import('../props/message/Index')
                    return {
                        element: <Message></Message>
                    }
                }
            },
            {
                path: 'my',
                lazy: async () => {
                    const { default: My } = await import('../props/my/Index')
                    return {
                        element: <My></My>
                    }
                }
            },
            {
                path: 'order',
                lazy: async () => {
                    const { default: Order } = await import('../props/order/Index')
                    return {
                        element: <Order></Order>
                    }
                }
            }
        ]
    },
    {
        path: '/login',
        lazy: async () => {
            const { default: Login } = await import('../props/login/Index')
            return {
                element: <Login></Login>
            }
        }
    },
    {
        path: '/cp',
        lazy: async () => {
            const { default: Cp,loader } = await import('../props/cp/Index')
            return {
                element: <Cp></Cp>,
                loader
            }
        }
    },
    {
        path: '/cplist:id',
        lazy: async () => {
            const { default: Cplist,loader } = await import('../props/cplist/Index')
            return {
                element: <Cplist></Cplist>,
                loader
            }
        }
    }
])
export default routers